import request from '@/utils/request'

export const FindAllTeachingClassByCourseIdAndTeacherId = (courseId, teacherId, academicYear, semester) => {
    const params = {};
    if (academicYear != null) params.academicYear = academicYear;
    if (semester != null) params.semester = semester;
    return request({
        url: `/admin/educational/recordScore/findAllTeachingClassByCourseIdAndTeacherId/${courseId}/${teacherId}`,
        method: 'get',
        params: params
    });
}

export const FindGradeInfoByPage = (pageNum, pageSize, teachingClassId) => {
    return request({
        url: '/admin/educational/recordScore/findGradeInfoByPage/' + pageNum + '/' + pageSize + '/' + teachingClassId,
        method: 'get'
    })
}

// 导出方法
export const ExportStudentData = () => {
    return request({
        url: '/admin/educational/recordScore/exportData',
        method: 'get',
        responseType: 'blob'  // // 这里指定响应类型为blob类型,二进制数据类型，用于表示大量的二进制数据
    })
}
export const SaveGradeDetailInfo = (gradeDetailInfo) => {
    return request({
        url: '/admin/educational/recordScore/saveGradeDetailInfo',
        method: 'post',
        data: gradeDetailInfo
    })
}
export const UpdateTotalScore = (gradeId, totalScore) => {
    return request({
        url: '/admin/educational/recordScore/updateTotalScore/' + gradeId + '/' + totalScore,
        method: 'put',
    })
}